<html>
<title>Verify that a "type" attribute on Object.prototype is ignored</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

promise_test(async t => {
  Object.prototype.type = 'incorrect';
  t.add_cleanup(() => { delete Object.prototype.type });
  const response = await fetch('no-inherit-type.html');
  const reader = response.body.getReader();
  let done;
  do {
    done = (await reader.read()).done;
  } while (!done);
}, 'fetch() should work when Object.prototype.type is set');

promise_test(async t => {
  Object.defineProperty(Object.prototype, 'type', {
    get: () => {
      throw new Error('this should not have been called');
    },
    set: undefined
  });
  t.add_cleanup(() => { delete Object.prototype.type });
  const response = await fetch('no-inherit-type.html');
  const reader = response.body.getReader();
  let done;
  do {
    done = (await reader.read()).done;
  } while (!done);
}, 'fetch() should work when Object.prototype.type is a getter that throws');

</script>
</html>

